package random;

public class FastArray2d extends CompactArray2d implements Array2dItt {

	public FastArray2d(int size) throws IllegalArgumentException {
		super(size);
	}

	@Override
	public boolean get4(int x, int y, int dir, int length) {
		int i;
		switch (dir) {
		case 0:
			if((x-1)%64-length > 0){
				return (( (-1l>>>(63-(x-1)%64)) & (-1l<<((x-length)%64))) & this.getLong(x-1, y) )!= 0;
			}
			if(((-1l>>>(63-(x-1)%64)) & this.getLong(x-1, y))!=0){
				return true;
			}
//			for(i=)
			break;
		case 1:
			for (i = 0; i < length && !this.get(x, y - i - 1); i++);
			return i != length;
		case 2:
			break;
		case 3:
			for (i = 0; i < length && !this.get(x, y + i + 1); i++);
			return i != length;
		}
		return false;
	}

	@Override
	public boolean set4(int x, int y, int dir, int length) {
		switch (dir) {
		case 0:
			break;
		case 1:
			for (int i = 0; i < length; i++)
				this.set(x, --y);	
			break;
		case 2:
			break;
		case 3:
			for (int i = 0; i < length; i++)
				this.set(x, ++y);	
			break;
		}
		return false;
	}

	@Override
	public boolean get6(int x, int y, int dir, int length) {
		switch (dir) {
		case 0:
			break;
		case 1:
			break;
		case 2:
			break;
		case 3:
			break;
		case 4:
			break;
		case 5:
			break;
		}
		return false;
	}

	@Override
	public boolean set6(int x, int y, int dir, int length) {
		switch (dir) {
			case 0:
				break;
			case 1:
				break;
			case 2:
				break;
			case 3:
				break;
			case 4:
				break;
			case 5:
				break;
			}
		return false;
	}

}
